home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue40 / Alfresco / UCvtFrac.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-10-31  |  808 b   |  45 lines

  1. unit UCvtFrac;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TCvtFraction = class(TForm)
  11.     Label1: TLabel;
  12.     Edit1: TEdit;
  13.     Button1: TButton;
  14.     Label2: TLabel;
  15.     Edit2: TEdit;
  16.     procedure Button1Click(Sender: TObject);
  17.   private
  18.     { Private declarations }
  19.   public
  20.     { Public declarations }
  21.   end;
  22.  
  23. var
  24.   CvtFraction: TCvtFraction;
  25.  
  26. implementation
  27.  
  28. uses
  29.   AACvFrac;
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure TCvtFraction.Button1Click(Sender: TObject);
  34. var
  35.   Value       : double;
  36.   Numerator   : longint;
  37.   Denominator : longint;
  38. begin
  39.   Value := StrToFloat(Edit1.Text);
  40.   ConvertFraction(Value, Numerator, Denominator);
  41.   Edit2.Text := IntToStr(Numerator) + '/' + IntToStr(Denominator);
  42. end;
  43.  
  44. end.
  45.